<?php

namespace App\Controller\Web;

use App\Base\BaseConfig;
use App\Base\BaseController4Web;
use App\Model\ArtCategoryModel;
use App\Model\ArtModel;
use App\Model\ContactAddressModel;
use App\Model\PagesModel;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;

class PagesController extends BaseController4Web
{
    /**
     * @route("/page/info",name="WebPageInfo")
     */
    public function WebFileItem(){
        $this->initData();
        $this->data["headTab"] = 'about';
        if (!$code = $this->getParamRequired("code")) {$code="ABOUT_INFO";}
        $PagesModel = new PagesModel($this->getDoctrine());
        $page = $PagesModel->getByKV("code",$code);

        if ($page->getCode()=="ABOUT_TEAM") {
            $ArtModel = new ArtModel($this->getDoctrine());
            $data = $ArtModel->getCatListData(BaseConfig::__CAT_TUANJIANHUODONG__,0,10);
            $this->data["list"] = $data["list"];
        }elseif($page->getCode()=="ABOUT_NEWS"){

            $ArtModel = new ArtModel($this->getDoctrine());
            $data = $ArtModel->getCatListData(BaseConfig::__CAT_QIYEXINWEN__,0,10);
            $this->data["list"] = $data["list"];
        }elseif($page->getCode()=="ABOUT_CONTACT"){
            $ContactAddressModel = new ContactAddressModel($this->getDoctrine());
            $this->data["list"] = $ContactAddressModel->getAllInOrders();
        }else{
            $this->data["list"] = false;
        }

        $this->data["page"] = $page;
        $this->data["latlng"] = "116.527013,39.966493";

        return $this->render("Web/page_comm.html.twig", $this->data);
    }
}
